|
|
|
|
|
|
|
udtErrDialog.Buttons = Array("&Exit")
frmErrDialog.Show vbModal
rtnValue = errExit
'
Case errresume, errNext
udtErrDialog.Title = "Error Message" & errRefName
udtErrDialog.Message = strMsg
udtErrDialog.Buttons = Array("&OK")
frmErrDialog.Show vbModal
rtnValue = errOption
'
Case Else
udtErrDialog.Title = "Error Message" & errRefName
udtErrDialog.Message = strMsg
udtErrDialog.Buttons = Array("&Cancel", "&Retry", "&Ignore")
frmErrDialog.Show vbModal
rtnValue = udtErrDialog.Return
End Select
'
' give it back
errHandler = rtnValue
'
End Function |
|
|
|
|
|
|
|
|
The code in Listing 14.18 calls a support function (errMsg) and a dialog box (frmErrDialog). You need to code these two remaining objects before you can test your error handler. Create a new function (errMsg) in the class module and enter the code from Listing 14.19 into the project. |
|
|
|
|
|
|
|
|
Listing 14.19. Adding the errMsg support function. |
|
|
|
|
|
|
|
|
Public Function errMsg(objErrColl As Variant, intType As errType) As String
'
' build and return complete error msg
'
Dim strMsg As String
Dim objItem As Error
'
strMsg = ""
'
If intType = errcoll Then
For Each objItem In objErrColl
strMsg = strMsg & "<" & CStr(objItem.Number) & "> "
strMsg = strMsg & objItem.Description
strMsg = strMsg & " (in " & objItem.Source & ")." & vbCrLf
Next
Else ' intType= errItem
strMsg = "<" & objErrColl.Number & "> "
strMsg = strMsg & objErrColl.Description |
|
|
|
|
|